import { UserProfilesAPI } from "@/request/api"
export default {
    namespaced: true,
    state: {
        userInfo: {
            nickName: "嘻嘻嘻",
            coin: 666,
            headImg: require("../../assets/img/bb2.png")
        },
        cartTotal: 5
    },
    mutations: {
        changeUerInfo(state, paylode) {
            state.userInfo = paylode.userInfo
            state.cartTotal = paylode.cartTotal
        },
        initUerInfo(state) {
            state.userInfo = {
                nickName: "嘻嘻嘻",
                coin: 666,
                headImg: require("../../assets/img/bb2.png")
            },
                state.cartTotal = 5
        }
    },
    actions: {
        async asyncchangeUerInfo({ commit }) {
            let user = await UserProfilesAPI()
            console.log(user, "00000000");
            commit("changeUerInfo", user.data)
        }
    }

}